package FileIO;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class OutputStreamDemo2 {
    public static void main(String[] args) throws IOException {
        // 追加写入
//        try (OutputStream outputStream = new FileOutputStream("d:/test.txt",true)) {
//            outputStream.write(65);
//            outputStream.write(66);
//            outputStream.write(67);
//            outputStream.write(68);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }

        try (OutputStream outputStream = new FileOutputStream("d:/test.txt",true)) {
            byte[] bytes = {65,66,67,68};
            outputStream.write(bytes);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
